package com.csk.zsk.compents.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.csk.zsk.commons.entity.IdEntity;

@Entity
@Table(name = "BOOK")
@JsonIgnoreProperties({ "bookChaptersList","url1","url2" })
public class Book extends IdEntity{
	private String name;
	private String author;
	private String url1;
	private String url2;
	private String pageurl;
	private String state;
	private String type;
	private String content;
	private Integer ordernum;
	private Integer recnum;

	private List<BookChapters> bookChaptersList;
	
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	public String getUrl1() {
		return url1;
	}
	public void setUrl1(String url1) {
		this.url1 = url1;
	}
	public String getUrl2() {
		return url2;
	}
	public void setUrl2(String url2) {
		this.url2 = url2;
	}
	public String getPageurl() {
		return pageurl;
	}
	public void setPageurl(String pageurl) {
		this.pageurl = pageurl;
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	@OneToMany(mappedBy = "book", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY, orphanRemoval = true)
	@Fetch(FetchMode.SUBSELECT)
	@OrderBy(value = "num")
	public List<BookChapters> getBookChaptersList() {
		return bookChaptersList;
	}
	public void setBookChaptersList(List<BookChapters> bookChaptersList) {
		this.bookChaptersList = bookChaptersList;
	}
	public Integer getOrdernum() {
		return ordernum;
	}
	public void setOrdernum(Integer ordernum) {
		this.ordernum = ordernum;
	}
	public Integer getRecnum() {
		return recnum;
	}
	public void setRecnum(Integer recnum) {
		this.recnum = recnum;
	}
	
	
	
	
}
